﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="krj_document.aspx.cs" Inherits="krj_document" %>

<%@ Register Src="~/UserControls/ucGridViewPager.ascx" TagName="ucGridViewPager" TagPrefix="Kerry" %>
<%@ Register src="~/UserControls/ucFavorite.ascx" tagname="ucFavorite" tagprefix="Kerry" %>


<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="Server">
    <script src="../../Scripts/bas_error.js"></script>
  <div>
    <table class="ConditionTable">
      <th colspan="4"><Kerry:ucFavorite ID="ucFavorite" runat="server" />表單維護
      </th>
      <tr>
          <td>部門 :
                    <asp:DropDownList ID="ddldept" runat="server" AppendDataBoundItems="True">
                      <asp:ListItem Value="">- All -</asp:ListItem>
                    </asp:DropDownList>
          
        </td>
        <td>表單類別 :
                    <asp:DropDownList ID="ddl_category" runat="server" AppendDataBoundItems="True" DataSourceID="SDS_MIS_CODE_DETAIL" DataTextField="document_category_name" DataValueField="document_category">
                      <asp:ListItem Value="">- All -</asp:ListItem>
                    </asp:DropDownList>
          <asp:SqlDataSource ID="SDS_MIS_CODE_DETAIL" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
            SelectCommand="SELECT distinct document_category,document_category || ' ' || document_category_name document_category_name FROM KRJ_CATEGORY_DOCUMENT ORDER BY document_category"></asp:SqlDataSource>
        </td>
        <td>表單代號 :
                    <asp:TextBox ID="txt_document_no" runat="server"></asp:TextBox>
        </td>
        <td>表單名稱 :
                    <asp:TextBox ID="txt_document_name" runat="server"></asp:TextBox>
        </td>
      </tr>
      <tr>
        <td colspan="4">
          <asp:Button ID="btn_search" runat="server" Text="查詢" OnClick="btn_query_Click" />
          <asp:Button ID="btn_insert" runat="server" Text="新增" OnClick="btn_insert_Click" />
          <%-- <asp:Button ID="btn_edit" runat="server" Text="修改" OnClick="btn_update_Click" />
                    <asp:Button ID="btn_view" runat="server" Text="檢視" OnClick="btn_update_Click" />--%>
          <asp:Button ID="btn_exit" runat="server" Text="離開" OnClick="btn_exit_Click" />
  <asp:Label ID="lbl_message" runat="server" EnableViewState="False" ForeColor="Red"></asp:Label>
        </td>
      </tr>
    </table>
    <br />
    <asp:GridView ID="gv_document" runat="server" AutoGenerateColumns="False" DataKeyNames="DOCUMENT_CATEGORY,DOCUMENT_NO" DataSourceID="SDS_KRJ_DOCUMENT" AllowPaging="True" OnRowCommand="gv_document_RowCommand" OnSelectedIndexChanged="gv_document_SelectedIndexChanged" OnPageIndexChanging="gv_document_PageIndexChanging">
      <Columns>
        <asp:TemplateField HeaderText="選取" HeaderStyle-Width="36">
          <ItemTemplate>
            <asp:ImageButton ID="ib_select" runat="server" CausesValidation="False" CommandName="Select" ImageUrl="~/Images/select.png" Width="24" Text="選取" Visible="false" />
            <asp:LinkButton ID="lb_select" runat="server" CausesValidation="False" CommandName="Select" Text="選取" Visible="false" />
            <asp:Button ID="btn_view" runat="server" CausesValidation="False" CommandName="Select" Text="檢視" />
            <asp:Button ID="btn_edit" runat="server" CausesValidation="False" CommandName="Select" Text="修改" />
            <asp:Button ID="btn_delete" runat="server" CausesValidation="False" CommandName="Select" Text="刪除" />
          </ItemTemplate>
          <HeaderStyle Width="150px"></HeaderStyle>
        </asp:TemplateField>
        <%--<asp:BoundField DataField="DOCUMENT_CATEGORY" HeaderText="DOCUMENT_CATEGORY" ReadOnly="True" SortExpression="DOCUMENT_CATEGORY" Visible="False" />--%>
        <asp:TemplateField HeaderText="部門代號" SortExpression="DEPT_ID">
          <ItemTemplate>
            <asp:Label ID="lbl_DEPT_NAME" runat="server" Text='<%# Bind("DEPT_NAME") %>' />
              <asp:Label ID="lbl_DEPT_ID" runat="server" Text='<%# Bind("DEPT_ID") %>' Visible="false" />
          </ItemTemplate>
        </asp:TemplateField>
          <asp:TemplateField HeaderText="類別代號" SortExpression="DOCUMENT_CATEGORY">
          <ItemTemplate>
            <asp:Label ID="lbl_DOCUMENT_CATEGORY" runat="server" Text='<%# Bind("DOCUMENT_CATEGORY") %>' />
          </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="類別名稱" SortExpression="DOCUMENT_CATEGORY_NAME">
          <ItemTemplate>
            <asp:Label ID="lbl_DOCUMENT_CATEGORY_NAME" runat="server" Text='<%# Bind("DOCUMENT_CATEGORY_NAME") %>'></asp:Label>
          </ItemTemplate>
        </asp:TemplateField>
          <asp:TemplateField HeaderText="表單代號" SortExpression="DOCUMENT_NO">
          <ItemTemplate>
            <asp:Label ID="lbl_DOCUMENT_NO" runat="server" Text='<%# Bind("DOCUMENT_NO") %>'></asp:Label>
            
          </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="表單名稱" SortExpression="DOCUMENT_NAME">
          <ItemTemplate>
            <asp:Label ID="lbl_DOCUMENT_NAME" runat="server" Text='<%# Bind("DOCUMENT_NAME") %>'></asp:Label>
          </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="ISSEQUENCE" HeaderText="ISSEQUENCE" SortExpression="ISSEQUENCE" Visible="False" />
        <asp:BoundField DataField="ISMAIL" HeaderText="ISMAIL" SortExpression="ISMAIL" Visible="False" />
        <asp:BoundField DataField="ISSTATISTICS" HeaderText="ISSTATISTICS" SortExpression="ISSTATISTICS" Visible="False" />
        <asp:BoundField DataField="ISTRANSFORM" HeaderText="ISTRANSFORM" SortExpression="ISTRANSFORM" Visible="False" />
        <asp:BoundField DataField="ISATTACHMENT" HeaderText="ISATTACHMENT" SortExpression="ISATTACHMENT" Visible="False" />
        <asp:BoundField DataField="ISPATH" HeaderText="ISPATH" SortExpression="ISPATH" Visible="False" />
        <asp:BoundField DataField="UPD_DOCUMENT_NO" HeaderText="UPD_DOCUMENT_NO" SortExpression="UPD_DOCUMENT_NO" Visible="False" />
        <asp:BoundField DataField="CRT_ID" HeaderText="CRT_ID" SortExpression="CRT_ID" Visible="False" />
        <asp:BoundField DataField="CRT_DATE" HeaderText="CRT_DATE" SortExpression="CRT_DATE" Visible="False" />
        <asp:BoundField DataField="CRT_TIME" HeaderText="CRT_TIME" SortExpression="CRT_TIME" Visible="False" />
        <asp:BoundField DataField="UPD_ID" HeaderText="UPD_ID" SortExpression="UPD_ID" Visible="False" />
        <asp:BoundField DataField="UPD_DATE" HeaderText="異動時間" SortExpression="UPD_DATE" />
        <asp:BoundField DataField="UPD_TIME" HeaderText="UPD_TIME" SortExpression="UPD_TIME" Visible="False" />
      </Columns>
      <PagerTemplate>
        <Kerry:ucGridViewPager ID="ucPager" runat="server" />
      </PagerTemplate>
    </asp:GridView>
    <asp:SqlDataSource ID="SDS_KRJ_DOCUMENT" runat="server"
      ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
      ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
      SelectCommand="SELECT A.dept_id, A.document_category, A.document_no, C.document_name, A.issequence, A.ismail, A.isstatistics, A.istransform, A.isattachment, A.ispath, A.upd_document_no, A.undertakers, A.download_year, A.crt_id, A.crt_date, A.crt_time, A.upd_id, A.upd_date, A.upd_time,B.DEPT_NAME,C.DOCUMENT_CATEGORY_NAME FROM TG.KRJ_DOCUMENT A left join MIS_DEPT_AP B on A.DEPT_ID = B.DEPT_ID LEFT JOIN krj_category_document C on A.DEPT_ID = C.DEPT_ID and A.DOCUMENT_CATEGORY = C.DOCUMENT_CATEGORY and A.DOCUMENT_NO = C.DOCUMENT_NO WHERE 1=1 "></asp:SqlDataSource>
  </div>
</asp:Content>

